package ups.Schedule;

import java.util.Comparator;

/* @discussion
 * Compares schedule items based on the port and the time. Two items with the same port will sort according to their exisiting order, while items with different ports sort based on time.
 */
public class OrderedScheduleItemComparator implements Comparator<ScheduleItem> {

	public int compare(ScheduleItem arg0, ScheduleItem arg1) {
		if( arg0.equals( arg1 )) return 0;
		
		if( arg0.isBefore( arg1 )) {
			return -1;
		}
		return 1;
	}
	
}